/** layuiAdmin.std-v1.2.1 LPPL License By http://www.layui.com/admin/ */
;layui.define(["table", "form", "util"], function (t) {
    var $ = layui.$, i = layui.table, n = layui.form, util = layui.util;
    var user = layui.data("user");
    let KE;
    i.render({
        elem: "#sharelist",
        //url: layui.setter.base + "json/content/list.js",
        url: "onlinecollegelist?login_name=" + user.user_id,
        cols: [
            [
                {type: "checkbox", fixed: "left"},
                {
                    field: "title", title: "文章标题", align: "center"
                }, {
                field: "type", title: "文章类型", templet: function (d) {
                    if (d.type == 1) {
                        return "拓客技巧";
                    } else if (d.type == 2) {
                        return "视频分享";
                    } else if (d.type == 3) {
                        return "公司介绍";
                    }
                }, align: 'center'
            }, {
                field: "createtime", title: "创建时间", templet: function (d) {
                    return util.toDateString(d.createtime);
                }, align: 'center'
            }, {
                title: "操作",
                minWidth: 150,
                align: "center",
                fixed: "right",
                toolbar: "#table-content-list"
            }]],
        page: !0,
        limit: 10,
        limits: [10, 15, 20, 25, 30],
        text: {none: "暂无数据"}
    }), i.on("tool(sharelist)", function (t) {
        var field = t.data;
        "del" === t.event ? layer.confirm("确定删除此分享？", function (e) {
            $.post("delShareContext", {id: field.id}, function (resp) {
                if (resp.code == "0") {
                    layer.msg(resp.msg);
                    t.del(), layer.close(e);
                } else {
                    layer.msg(resp.msg);
                    layer.close(e);
                }
            })


        }) : "edit" === t.event && layer.open({
            type: 2,
            title: "编辑文章",
            content: "onlineform?id=" + field.id,
            maxmin: !0,
            area: ["550px", "550px"],
            btn: ["确定", "取消"],
            success: function (layero, index) {
                layer.full(index);
                let body = layer.getChildFrame('body', index);
                body.find('#title').val(field.title);
                body.find('#sharetype').val(field.type);

            },
            yes: function (index, layero) {
                const submit = layero.find('iframe').contents().find("#layuiadmin-app-form-edit");
                submit.click();

            }
        })
    }),
        i.render({
            elem: "#LAY-app-content-tags",
            url: layui.setter.base + "json/content/tags.js",
            cols: [[{type: "numbers", fixed: "left"}, {field: "id", width: 100, title: "ID", sort: !0}, {
                field: "tags",
                title: "分类名",
                minWidth: 100
            }, {title: "操作", width: 150, align: "center", fixed: "right", toolbar: "#layuiadmin-app-cont-tagsbar"}]],
            text: "对不起，加载出现异常！"
        }), i.on("tool(LAY-app-content-tags)", function (t) {
        var i = t.data;
        if ("del" === t.event) layer.confirm("确定删除此分类？", function (e) {
            t.del(), layer.close(e)
        }); else if ("edit" === t.event) {
            e(t.tr);
            layer.open({
                type: 2,
                title: "编辑分类",
                content: "../../../views/app/content/tagsform.html?id=" + i.id,
                area: ["450px", "200px"],
                btn: ["确定", "取消"],
                yes: function (e, i) {
                    var n = i.find("iframe").contents().find("#layuiadmin-app-form-tags"),
                        l = n.find('input[name="tags"]').val();
                    l.replace(/\s/g, "") && (t.update({tags: l}), layer.close(e))
                },
                success: function (t, e) {
                    var n = t.find("iframe").contents().find("#layuiadmin-app-form-tags").click();
                    n.find('input[name="tags"]').val(i.tags)
                }
            })
        }
    }), i.render({
        elem: "#LAY-app-content-comm",
        url: layui.setter.base + "json/content/comment.js",
        cols: [[{type: "checkbox", fixed: "left"}, {
            field: "id",
            width: 100,
            title: "ID",
            sort: !0
        }, {field: "reviewers", title: "评论者", minWidth: 100}, {
            field: "content",
            title: "评论内容",
            minWidth: 100
        }, {field: "commtime", title: "评论时间", minWidth: 100, sort: !0}, {
            title: "操作",
            width: 150,
            align: "center",
            fixed: "right",
            toolbar: "#table-content-com"
        }]],
        page: !0,
        limit: 10,
        limits: [10, 15, 20, 25, 30],
        text: "对不起，加载出现异常！"
    }), i.on("tool(LAY-app-content-comm)", function (t) {
        t.data;
        "del" === t.event ? layer.confirm("确定删除此条评论？", function (e) {
            t.del(), layer.close(e)
        }) : "edit" === t.event && layer.open({
            type: 2,
            title: "编辑评论",
            content: "../../../views/app/content/contform.html",
            area: ["450px", "300px"],
            btn: ["确定", "取消"],
            yes: function (t, e) {
                var n = window["layui-layer-iframe" + t], l = "layuiadmin-app-comm-submit",
                    a = e.find("iframe").contents().find("#" + l);
                n.layui.form.on("submit(" + l + ")", function (e) {
                    e.field;
                    i.reload("LAY-app-content-comm"), layer.close(t)
                }), a.trigger("click")
            },
            success: function (t, e) {
            }
        })
    }), t("onlinecollege", {})
});